#include <iostream>
#include <memory>

#include "udp_server.hpp"
#include "Route.hpp"
#include "log.hpp"

using namespace log_ns;


int main(int argc, char *argv[])
{
    if(argc != 2)
    {
        std::cout << "Usage: " << argv[0] << "local-port" << std::endl;
        exit(0);
    }
    
    uint16_t port = std::stoi(argv[1]);
    EnableScreen();

    Rotue MessageRotue;

    service_t message_rotue = std::bind(&Rotue::forward,\
        &MessageRotue,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3);

    std::unique_ptr<Udpserver> udp = std::make_unique<Udpserver>(message_rotue,port);

    udp->Init();
    udp->Start();

    return 0;
}